﻿using System;

namespace UniRx
{
	// Token: 0x02000221 RID: 545
	public class BooleanNotifier : IObservable<bool>
	{
		// Token: 0x06000CEE RID: 3310 RVA: 0x0003E95C File Offset: 0x0003CD5C
		public BooleanNotifier(bool initialValue = false)
		{
			this.Value = initialValue;
		}

		// Token: 0x17000105 RID: 261
		// (get) Token: 0x06000CEF RID: 3311 RVA: 0x0003E976 File Offset: 0x0003CD76
		// (set) Token: 0x06000CF0 RID: 3312 RVA: 0x0003E97E File Offset: 0x0003CD7E
		public bool Value
		{
			get
			{
				return this.boolValue;
			}
			set
			{
				this.boolValue = value;
				this.boolTrigger.OnNext(value);
			}
		}

		// Token: 0x06000CF1 RID: 3313 RVA: 0x0003E993 File Offset: 0x0003CD93
		public void TurnOn()
		{
			if (!this.Value)
			{
				this.Value = true;
			}
		}

		// Token: 0x06000CF2 RID: 3314 RVA: 0x0003E9A7 File Offset: 0x0003CDA7
		public void TurnOff()
		{
			if (this.Value)
			{
				this.Value = false;
			}
		}

		// Token: 0x06000CF3 RID: 3315 RVA: 0x0003E9BB File Offset: 0x0003CDBB
		public void SwitchValue()
		{
			this.Value = !this.Value;
		}

		// Token: 0x06000CF4 RID: 3316 RVA: 0x0003E9CC File Offset: 0x0003CDCC
		public IDisposable Subscribe(IObserver<bool> observer)
		{
			return this.boolTrigger.Subscribe(observer);
		}

		// Token: 0x04000748 RID: 1864
		private readonly Subject<bool> boolTrigger = new Subject<bool>();

		// Token: 0x04000749 RID: 1865
		private bool boolValue;
	}
}
